package com.galaxy.payment.api;

import com.galaxy.common.core.domain.R;
import com.galaxy.payment.domain.OrderBo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 商品服务降级处理
 */
@Component
public class RemoteOrderFallbackFactory implements FallbackFactory<RemoteOrderService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteOrderFallbackFactory.class);

    @Override
    public RemoteOrderService create(Throwable cause) {
        log.error("订单服务调用失败: {}", cause.getMessage());
        return new RemoteOrderService() {
            @Override
            public R<Boolean> edit(OrderBo bo) {
                return R.ok("订单服务调用失败");
            }
        };
    }
}
